import { Component, OnInit } from '@angular/core';
import { UserService } from '../../services/user/user.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {

  constructor(private us:UserService,private router:Router) { }

  loginTel:string='';
  pwd:string='';

  ngOnInit() {
  }

  doLogin(){
    this.us.login(this.loginTel,this.pwd).subscribe((data)=>{
        let result  = data.json();
        //console.log(result);
        if(result.code == "success"){
            this.router.navigate(["/"]);
        }
    });
  }

}
